package com.input4hua.observer.observer;

import com.input4hua.observer.subject.Subject;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


/**
 * Created by jiahua.hu on 2019/2/16.
 */
public class ObserverImp implements Observer {

    private final static ExecutorService pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

    @Override
    public void update(Subject subject, final String message) {
        pool.execute(() -> System.out.println("observer receive " + " message : " + message));
    }
}
